package com.geekjob1120.geekjob1120pay.support;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.geekjob1120.geekjob1120pay.modle.PayWay;
import org.springframework.boot.jackson.JsonComponent;

import java.io.IOException;

@JsonComponent
public class PayWaySerializer extends StdSerializer<PayWay> {
    public PayWaySerializer() {
        super(PayWay.class);
    }

    @Override
    public void serialize(PayWay value, JsonGenerator gen, SerializerProvider provider) throws IOException {
        gen.writeString(value.getCode());
    }
}
